import scrapy
from scrapy import Request
import time
import random
 
class TechlabpltSpider(scrapy.Spider):
    name = "techlabplt"
    allowed_domains = ["www.techlabplt.com"]
    init_url = "http://www.techlabplt.com:8080/BD-PC/priceList"
    def start_requests(self):
        for page in range(1, 3):
            url = self.init_url +"?pageId=" + str(page)
            print("第", page)
            time.sleep(1)
            yield Request(url,
                          callback=self.parse_custom)
 
    def parse_custom(self, response):
        # request 请求的URL
        print('response.url：', response.url)
        # response对应的request对象
        print('response.request：', response.request)
        # response的状态码
        print('response.status：', response.status)
        # response的响应头
        print('response.headers：', response.headers)
